#include<iostream>
#include<cmath>
using namespace std;
struct re{
    int d,x,y;
    friend ostream& operator<<(ostream &out,const re &temp)
    {
        out<<temp.d<<" "<<temp.x<<" "<<temp.y<<endl;
    }
};
re extended_gcd(int a,int b)
{
    if(b==0) return re{a,1,0};
    else {
        re from=extended_gcd(b,a%b);
        re to=from;
        to.d=from.d;
        to.x=from.y;
        to.y=from.x-(a/b)*from.y;
        return to;
    }
}
void mod_func()
{
    int a,b,n;
    cin>>a>>b>>n;
    //求解ax=b(modn);
    re temp=extended_gcd(a,n);
    // cout<<temp;
    if(b%temp.d==0)
    {
        int x0=(temp.x*b/temp.d)%n;
        for(int i=0;i<temp.d;i++)
        {
            x0=(x0+n/temp.d)%n;
            cout<<x0<<" ";
        }
    }
}

//a^-1modn
int mod_func(int a,int n)
{
    re temp=extended_gcd(a,n);
    // cout<<temp;
    if(1%temp.d==0)
    {
        int x0=(temp.x*1/temp.d)%n;
        return (x0+n)%n;
        // return x0;//可能为负数
    }
}
int chinese_mod()
{
    int a[10],n[10];
    int m,result=0,mul=1;cin>>m;
    for(int i=1;i<=m;i++)
    cin>>a[i]>>n[i],mul*=n[i];
    for(int i=1;i<=m;i++)
    {
        result=(result+a[i]*mul/n[i]*mod_func(mul/n[i],n[i]))%mul;
    }
    return result;
}


void rsa()
{
    int p=11,q=29,n=319,e=3,m=100;
    int fai=(p-1)*(q-1);
    re temp=extended_gcd(e,fai);
    // cout<<temp;
    cout<<"M:"<<m<<endl;
    if(temp.d==1)
    {
        int x0=((temp.x/temp.d)%fai+fai)%fai;
        int pm=pow(m,e);pm%=n;
        cout<<"P(M):"<<pm<<endl;
        int sc=1;
        for(int i=0;i<x0;i++)
        {
            sc=(sc*pm)%n;
        }
        cout<<"R(C):"<<sc;
    }
}
int main()
{
    // int a,b;cin>>a>>b;
    // rsa();    
    // cout<<extended_gcd(99,78);
    cout<<mod_func(5,11);
    // cout<<chinese_mod();
}